<BR />
<?
	$id_art = $_GET['idart'];
	
	if(isset($_POST['commentaire'])) {
		$ajout_auteur = $_POST['auteur'];
		$ajout_mail = $_POST['aut_mail'];
		$ajout_date = getdate();
		$ajout_com = $_POST['commentaire'];
		$anti_spam = $_POST['antispam'];
		$anti_spam = trim($anti_spam);
		$valeur_anti_spam = "deux";
		echo (strcmp($anti_spam,$valeur_anti_spam) == 0); 
		if (strcmp($anti_spam,$valeur_anti_spam) == 0){
  		$result = mysql_query("INSERT INTO `commentaires`(`id`, `id_art`,`auteur`, `aut_mail`, `date_com`, `texte`) VALUES ('', '".$id_art."', '".$ajout_auteur."', '".$ajout_mail."', '".$ajout_date['year']."-".$ajout_date['mon']."-".$ajout_date['mday']."', \"".$ajout_com."\")");
  		
  		if (!$result) {
     			die('RequÛte invalide : ' . mysql_error());
  		}
		}
	}
	
	$liste_comments = mysql_query("SELECT * FROM commentaires WHERE id_art = ".$id_art);
	$nb_comments = mysql_numrows($liste_comments);
	
	$comments_vus = 0;
	
?>
<TABLE WIDTH=100%>
<TD align="center">
<TABLE WIDTH=749 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD><IMG SRC="images/articles_01.gif" WIDTH=12 HEIGHT=22 ALT=""></TD>
		<TD background="images/articles_02.gif" WIDTH=725 HEIGHT=22><B>Commentaires</B></TD>
		<TD><IMG SRC="images/articles_03.gif" WIDTH=12 HEIGHT=22 ALT=""></TD>
	</TR>
	<TR>
		<TD><IMG SRC="images/articles_04.gif" WIDTH=12 HEIGHT=12 ALT=""></TD>
		<TD><IMG SRC="images/articles_05.gif" WIDTH=725 HEIGHT=12 ALT=""></TD>
		<TD><IMG SRC="images/articles_06.gif" WIDTH=12 HEIGHT=12 ALT=""></TD>
	</TR>
	<TR>
		<TD background="images/articles_07.gif" WIDTH=12></TD>
		<TD WIDTH=725 background="images/articles_08.gif">
<?
	while ($comments_vus < $nb_comments) {	
						
		$auteur = mysql_result($liste_comments,$comments_vus,"auteur");
		$mail = mysql_result($liste_comments,$comments_vus,"aut_mail");
		$texte = nl2br(mysql_result($liste_comments,$comments_vus,"texte"));
		$date = mysql_result($liste_comments,$comments_vus,"date_com");
		
		if ($comments_vus > 0) { echo "<HR />"; }	
?>
			<B><? echo ucfirst($auteur); ?></B>, le <? echo $date; ?><BR><BR>
			<? echo $texte; ?>
			<BR /><BR />
<?
			
		$comments_vus++;
	}
?>

</TD>
		<TD background="images/articles_09.gif" WIDTH=12></TD>
	</TR>
	<TR>
		<TD><IMG SRC="images/articles_10.gif" WIDTH=12 HEIGHT=21 ALT=""></TD>
		<TD background="images/articles_11.gif" WIDTH=725 HEIGHT=21 valign="center" align="right">
			
		</TD>
		<TD><IMG SRC="images/articles_12.gif" WIDTH=12 HEIGHT=21 ALT=""></TD>
	</TR>
</TABLE>
</TD>
</TABLE>	
	
<TABLE WIDTH="100%">
	<TD align="center"><A HREF="index.php?page=articles" class="blanc">Revenir Ó la liste des articles</A></TD>
</TABLE>
